package com.chen.vo; /**
 * @ProjectName: springBootXm
 * @Package: com.chen.bolg.vo
 * @ClassName: Result
 * @Author: Chen
 * @Description:
 * @Date: 2022/7/28 15:27
 * @Version: 1.0
 */

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import org.springframework.stereotype.Controller;

/**
 *@ClassNameResult
 *@Author CWS
 @Date 2022/7/28 15:27
 @Version 1.0
 **/
@Data
@ToString
@AllArgsConstructor
@NoArgsConstructor
public class Result {
    private boolean success;

    private Integer code;

    private String msg;

    private Object data;

    private Object pageParams;
    public static Result success() {
        return new Result(true,200,"success","",null);
    }

    public static Result success(Object data) {
        return new Result(true,200,"success",data,null);
    }
    public static Result fail(Integer code, String msg) {
        return new Result(false,code,msg,null,null);
    }
    public static Result fail() {
        return new Result(false,500,"服务出现错误，请联系管理员~",null,null);
    }

    public static Result custom(boolean success,Integer code,String msg,Object data) {
        return new Result(success,code,msg,data,null);
    }

    public static Result successPage(Object data, Object pageParams){
        return new Result(true,200,"success",data,pageParams);
    }


}
